﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
namespace Sbook.Data
{
    public class UserInfo
    {
        #region[Declare variables]
        private string _UId;
        private string _Username;
        private string _Pass;
        private string _isAdmin;
        private string _Fullname;
        private string _Address;
        private string _Provenumber;
        private string _Email;
        private string _Phone;
        private string _Class;
        private string _University;
        private string _Status;

        #endregion
        #region[Public Properties]
        public string UId { get { return _UId; } set { _UId = value; } }
        public string Username { get { return _Username; } set { _Username = value; } }
        public string Pass { get { return _Pass; } set { _Pass = value; } }
        public string isAdmin { get { return _isAdmin; } set { _isAdmin = value; } }
        public string Fullname { get { return _Fullname; } set { _Fullname = value; } }
        public string Address { get { return _Address; } set { _Address= value; } }
        public string Provenumber { get { return _Provenumber; } set { _Provenumber = value; } }
        public string Email { get { return _Email; } set { _Email = value; } }
        public string Phone { get { return _Phone; } set { _Phone = value; } }
        public string University
        {
            get { return _University; }
            set { _University = value; }
        }

        public string Class
        {
            get { return _Class; }
            set { _Class = value; }
        }

        public string Status
        {
            get { return _Status; }
            set { _Status = value; }
        }
        public string MailTo { get; set; }
        public string FullNameTo { get; set; }
        public string AddressTo { get; set; }
        public string PhoneTo { get; set; }
        #endregion
        #region[User IDataReader]
        public UserInfo UserIDataReader(IDataReader dr)
        {
            Data.UserInfo obj = new Data.UserInfo();
            obj.UId = (dr["UId"] is DBNull) ? string.Empty : dr["UId"].ToString();
            obj.Username = (dr["Username"] is DBNull) ? string.Empty : dr["Username"].ToString();
            obj.Pass = (dr["Pass"] is DBNull) ? string.Empty : dr["Pass"].ToString();
            obj.isAdmin = (dr["isAdmin"] is DBNull) ? string.Empty : dr["isAdmin"].ToString();
            obj.Fullname = (dr["Fullname"] is DBNull) ? string.Empty : dr["Fullname"].ToString();
            obj.Address = (dr["Address"] is DBNull) ? string.Empty : dr["Address"].ToString();
            obj.Provenumber = (dr["Provenumber"] is DBNull) ? string.Empty : dr["Provenumber"].ToString();
            obj.Email = (dr["Email"] is DBNull) ? string.Empty : dr["Email"].ToString();
            obj.Phone = (dr["Phone"] is DBNull) ? string.Empty : dr["Phone"].ToString();
            obj.Class = (dr["Class"] is DBNull) ? string.Empty : dr["Class"].ToString();
            obj.University = (dr["University"] is DBNull) ? string.Empty : dr["University"].ToString();
            obj.Status = (dr["Status"] is DBNull) ? string.Empty : dr["Status"].ToString();
            obj.MailTo = (dr["MailTo"] is DBNull) ? string.Empty : dr["MailTo"].ToString();
            obj.FullNameTo = (dr["FullNameTo"] is DBNull) ? string.Empty : dr["FullNameTo"].ToString();
            obj.AddressTo = (dr["AddressTo"] is DBNull) ? string.Empty : dr["AddressTo"].ToString();
            obj.PhoneTo = (dr["PhoneTo"] is DBNull) ? string.Empty : dr["PhoneTo"].ToString();
            return obj;
        }
        #endregion
    }
}